import { createRouter, createWebHistory } from 'vue-router'
import { createLoginComponent } from 'yklib'

const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      redirect: '/login' // 重定向到登录页面，如果不需要登录页面，可以直接将路由转到HomeView组件
    },
    {
      path: '/login', // 如果不需要登录页面，可以直接将路由转到HomeView组件
      name: 'login',
      component: createLoginComponent({})
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('../views/HomeView.vue')
    },
    {
      path: '/about',
      name: 'about',
      component: () => import('../views/AboutView.vue')
    },
    {
      path: '/settings',
      name: 'settings',
      component: () => import('../views/Settings.vue')
    },
    {
      path: '/create-task',
      name: 'create-task',
      component: () => import('../views/CreateTask.vue')
    },
    {
      path: '/poe',
      name: 'poe',
      component: () => import('../views/POE.vue')
    }
  ]
})

export default router
